﻿using SqlSugar;

namespace Api.Shared.Model.XinYa
{
    
    public class TestReport
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(IsNullable = true)]
        public DateTime ReportTime { get; set; } = DateTime.Now;

        [SugarColumn(IsNullable = true)]
        public string Operator { get; set; } = string.Empty;

        [SugarColumn(IsNullable = true)]
        public string ProductName { get; set; } = string.Empty;

        [SugarColumn(IsNullable = true)]
        public string ModelName { get; set; } = string.Empty;


        [SugarColumn(IsNullable = true)]
        public string SerialNumber { get; set; } = string.Empty;

        [SugarColumn(IsNullable = true)]
        public int TestType { get; set; }


        [SugarColumn(IsNullable = true)]
        [Navigate(NavigateType.OneToMany, nameof(TestRecord.TestReportId))]
        public List<TestRecord>? TestRecords { get; set; }

        [SugarColumn(IsNullable = true)]
        public string VoltageListStr => VoltageList != null && VoltageList.Count > 0 ? string.Join(",", VoltageList) : string.Empty;

        [SugarColumn(IsNullable = true)]
        public string CurrentListStr => CurrentList != null && CurrentList.Count > 0 ? string.Join(",", CurrentList) : string.Empty;

        [SugarColumn(IsNullable = true)]
        public string PDListStr => PDList != null && PDList.Count > 0 ? string.Join(",", PDList) : string.Empty;

        [SugarColumn(IsIgnore = true)]
        public List<double>? VoltageList { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<double>? CurrentList { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<double>? PDList { get; set; }
    }
}
